﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace DevelopStudio.Basic
{
    [Serializable]
    [XmlRoot("root")]
    public class IdNamePair
    {
        [XmlAttribute("id")]
        public string ID { get; set; }

        public int GetID()
        {
            int id;
            
            if (int.TryParse(ID, out id) == false)
            {
                return 0;
            }

            return id;
        }

        [XmlAttribute("name")]
        public string Name { get; set; }

        [XmlElement("value")]
        public string Value { get; set; }
    }
}
